/** Zombie Navigator

Copyright © 2016  Zombie Navigator Developers

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.


The latest version of the GNU AGPL should be available here:
<https://www.gnu.org/licenses/agpl.html>


== What's this? ==
This is a Firefox addon with few GUI elements. (Mainly intended to run
unattended with something like pseudo-headless `xvfb-run firefox`.) On
launch, if instructed to run a Zombie script, it runs that script inside a
sandbox but does nothing otherwise. Please note that we only test the addon
on a GNU/Linux system. Since it is designed as a pure-SDK addon, it may run
under other platforms. In general, it should not do any harm there.


== How to use it ==
See the attached docs.


== How does it work? ==
Please see the source code.

A Zombie script runs inside a sandbox, so it does not have the privileges
the addon itself has. It cannot do `require ('chrome')` or even
`require ('sdk/page-mod')`. It can only access the Zombie API, using the
CommonJS environment the SDK provides. However this addon has limited
control over its execution since the addon is purely written with the Addon
SDK. (XXX: We want more strong API, Mozilla! Because we choose *Firefox*,
not Google Chrome!)

A Zombie script can open a new window. It can then manipulate tabs on that
window. But it SHALL NOT access any other windows. (TODO: Zombie-controlled
windows should indicate as such) As a rule, a Zombie script has no access
to anything that is not explicitly under its control.

Zombie scripts must not have access to persistent storages or local files.
They are not allowed to enumerate windows or tabs including those under the
scripts' control.

On platforms (if any) specified in system-blacklist.json, this addon
refuses to autostart Zombie scripts using environment variables. Signing
requirement makes it impossible to fool this mechanism.


== Coding (PLEASE READ) ==
* UTF-8 Everywhere, Some ES6 + strict mode (FF 38+)
* Use SDK as much as possible (without chrome access) But SDK is incomplete,
not strong enough and sometimes buggy especially when we try to do complex
things. Unlike Google Chrome, we want FF to support really complex and
non-trivial addons. We believe addons are not just for "fancy things" but for
doing truly innovative things, which require strong and complete APIs.

Please read README.markdown in the source dist.
Clone via git: https://notabug.org/desktopd/zombie-navigator


@file
@license AGPL-3.0+

*/ 'use strict';


// Should print nothing unless there is an error
try {
	require('./utils/input').acceptInput();
	
	const uri = require('./utils/system').getScriptURI();
	if (false === uri) { // NOOP
		require('./utils/help').showHelpIfNecessary();
	} else {
		require('./utils/script-loader').runScript(uri);
	}
	
	/*!_DEBUGONLY_!*/ require('./debug.js');
} catch (e) {
	require('./utils/error').print(e);
}


// vim: ts=4 noet ai

